﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ToolSheetList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
       
            SetData();
        }

    }

    public void SetData()
    {
        ConnectionStringSettings connObj = ConfigurationManager.ConnectionStrings["smsConnectionString"];
        string connectionString = connObj.ConnectionString;
        SqlConnection objConnection = new SqlConnection(connectionString);

        String query = "select ToolSheet.ToolSheetID, aspnet_Users.UserName AS 申请人 ,ConstructionCorp AS 施工单位,Convert(char(10),ProposeDate,121) AS 申请日期,Convert(char(10),StartDate,121) AS 开始日期,Convert(char(10),FinishDate,121) AS 结束日期"+
                        " from ToolSheet, aspnet_Users where ToolSheet.ProposerID = aspnet_Users.UserId"+
                         " and ToolSheet.DeptAuditStatus = '批准' and ToolSheet.AuditStatus = '待批'";// and staffInfo.DepartmentID = " + Session["UserDepartmentID"].ToString;

        SqlDataAdapter da = new SqlDataAdapter(query, objConnection);

        DataSet ds = new DataSet();
        da.Fill(ds, "工具单申请");
        DataTable dt = ds.Tables["工具单申请"];
        DataView view = new DataView(dt);

        this.UltraWebGrid1.DataSource = view;
        this.UltraWebGrid1.DataKeyField = "ToolSheetID";
        this.UltraWebGrid1.DataBind();
        this.UltraWebGrid1.Columns[1].Hidden = true;

    }

    public static string GetNavigateUrl(Object item1)
    {
        String strToolSheetID = (String)System.Web.UI.DataBinder.Eval(item1, "ToolSheetID");

        String result = "~/ToolSheetAudit.aspx?ToolSheetID=";
        result += strToolSheetID;
        return result;
    }


}
